﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;

public partial class zhuce : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        string id = txtID.Text.Trim();
        string ps = txtPS.Text.Trim();
        string username = txtUserName.Text.Trim();
        string email= txtEmail.Text.Trim();
     


        user tmp = new user();
        tmp.id = id;
        tmp.ps = ps;
        tmp.username = username;
        tmp.email = email;
       
        int result = tmp.Addoneuser(tmp);
        if (result > 0)
        {
            Response.Write("<script>alert(\"恭喜你，注册成功!\")</script>");
        }
        else
        {
            Response.Write("<script>alert(\"对不起，注册失败!\")</script>");
        }
    }
    protected void btnSearch_Click(object sender, EventArgs e)
    {
        string id = txtID.Text.Trim();
        user us = new user();
        us.id = id;
        int result = us.IsidExist(us);
        if (result > 0)
        {
            lblMsg.Visible = true;
            lblMsg.Text = "这个账号已经存在！";
            btnSubmit.Enabled = false;
        }
        else
        {
            lblMsg.Visible = true;
            lblMsg.Text = "这个账号可用！";
            btnSubmit.Enabled = true;
        }
    }
    protected void btnCancel_Click(object sender, EventArgs e)
    {

    }
}